/**
 * 
 * 广州锐鹏计算机科技有限公司（www.ruipengkj.com）
 * 
 * 
 * Copyright (c) 2011-2012 RUIPENGKJ.Co.Ltd. All rights reserved.
 * 
 * */
package com.ruipengkj.bean;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 说明：
 * Entity Name 角色
 * @Author：李智深
 * @Date：2012-03-14
 */
@Entity
@Table(name="ruipeng_tb_TRole")
public class TRole implements Serializable{

	private static final long serialVersionUID = 1L;

	private String RoleID;//角色编号CHAR(15) PK
	
	private String Name;//角色名称VARCHAR(100)
	
	private String Des;//角色说明VARCHAR(200)
	
	private Set<TEmployee> TEmployees=new HashSet<TEmployee>(0);//员工
	
	private Set<TRoleRight> TRoleRights=new HashSet<TRoleRight>(0);//角色权限表

	public TRole(){}
	public TRole(String RoleID){
		this.RoleID=RoleID;
	}
	
	@Id
	@Column(name = "RoleID", length=15)
	public String getRoleID() {
		return RoleID;
	}

	public void setRoleID(String roleID) {
		RoleID = roleID;
	}

	@Column(name = "Name", length=100)
	public String getName() {
		return Name;
	}

	public void setName(String name) {
		Name = name;
	}

	@Column(name = "Des", length=200)
	public String getDes() {
		return Des;
	}

	public void setDes(String des) {
		Des = des;
	}

	@OneToMany(mappedBy="TRole",fetch=FetchType.EAGER)
	@JoinColumn(name="RoleID")
	public Set<TEmployee> getTEmployees() {
		return TEmployees;
	}

	public void setTEmployees(Set<TEmployee> tEmployees) {
		TEmployees = tEmployees;
	}

	@OneToMany(mappedBy="TRole",fetch=FetchType.EAGER)
	@JoinColumn(name="RoleID")
	public Set<TRoleRight> getTRoleRights() {
		return TRoleRights;
	}

	public void setTRoleRights(Set<TRoleRight> tRoleRights) {
		TRoleRights = tRoleRights;
	}
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return this.Name;
	}
	@Override
	public boolean equals(Object obj) {
		// TODO Auto-generated method stub
		return RoleID.equals(((TRole)obj).RoleID);
	}
	
	
	
	
}
